#ifndef RBTREE_H
#define RBTREE_H
enum RBClor {RED, BLACK};
typedef int KeyType;
/* 红黑树节点结构 */
typedef struct RBNode {
	char color;
	KeyType key;
	struct RBNode *parent;
	struct RBNode *left;
	struct RBNode *right;
} RBNode;

/* 定义结构，红黑树头 */
typedef struct {
	RBNode *root;
	int count;
} RBTree;

RBTree *initRBTree();
void releaseRBTree(RBTree* tree);

// 向红黑树插入值
void insertRBTree(RBTree *tree, KeyType key);
void printRBTree(RBTree *tree);
RBNode *searchRBNode(RBTree *tree, KeyType key);
void deleteRBTree(RBTree *tree, KeyType key);

#endif //RBTREE_H
